package com.mob.tools.utils;

import java.io.FileOutputStream;
import java.nio.channels.FileLock;

public class FileLocker
{
  private FileOutputStream fos;
  private FileLock lock;

  public void lock(Runnable paramRunnable, boolean paramBoolean)
  {
    try
    {
      if ((lock(paramBoolean)) && (paramRunnable != null))
        paramRunnable.run();
      return;
    }
    finally
    {
    }
  }

  // ERROR //
  public boolean lock(boolean paramBoolean)
  {
    // Byte code:
    //   0: aload_0
    //   1: monitorenter
    //   2: aload_0
    //   3: getfield 25	com/mob/tools/utils/FileLocker:fos	Ljava/io/FileOutputStream;
    //   6: astore_3
    //   7: iconst_0
    //   8: istore 4
    //   10: aload_3
    //   11: ifnonnull +8 -> 19
    //   14: aload_0
    //   15: monitorexit
    //   16: iload 4
    //   18: ireturn
    //   19: iload_1
    //   20: ifeq +37 -> 57
    //   23: aload_0
    //   24: aload_0
    //   25: getfield 25	com/mob/tools/utils/FileLocker:fos	Ljava/io/FileOutputStream;
    //   28: invokevirtual 31	java/io/FileOutputStream:getChannel	()Ljava/nio/channels/FileChannel;
    //   31: invokevirtual 36	java/nio/channels/FileChannel:lock	()Ljava/nio/channels/FileLock;
    //   34: putfield 38	com/mob/tools/utils/FileLocker:lock	Ljava/nio/channels/FileLock;
    //   37: aload_0
    //   38: getfield 38	com/mob/tools/utils/FileLocker:lock	Ljava/nio/channels/FileLock;
    //   41: astore 8
    //   43: iconst_0
    //   44: istore 4
    //   46: aload 8
    //   48: ifnull -34 -> 14
    //   51: iconst_1
    //   52: istore 4
    //   54: goto -40 -> 14
    //   57: aload_0
    //   58: aload_0
    //   59: getfield 25	com/mob/tools/utils/FileLocker:fos	Ljava/io/FileOutputStream;
    //   62: invokevirtual 31	java/io/FileOutputStream:getChannel	()Ljava/nio/channels/FileChannel;
    //   65: invokevirtual 41	java/nio/channels/FileChannel:tryLock	()Ljava/nio/channels/FileLock;
    //   68: putfield 38	com/mob/tools/utils/FileLocker:lock	Ljava/nio/channels/FileLock;
    //   71: goto -34 -> 37
    //   74: astore 5
    //   76: aload_0
    //   77: getfield 38	com/mob/tools/utils/FileLocker:lock	Ljava/nio/channels/FileLock;
    //   80: astore 6
    //   82: aload 6
    //   84: ifnull -47 -> 37
    //   87: aload_0
    //   88: getfield 38	com/mob/tools/utils/FileLocker:lock	Ljava/nio/channels/FileLock;
    //   91: invokevirtual 46	java/nio/channels/FileLock:release	()V
    //   94: aload_0
    //   95: aconst_null
    //   96: putfield 38	com/mob/tools/utils/FileLocker:lock	Ljava/nio/channels/FileLock;
    //   99: goto -62 -> 37
    //   102: astore_2
    //   103: aload_0
    //   104: monitorexit
    //   105: aload_2
    //   106: athrow
    //   107: astore 7
    //   109: goto -15 -> 94
    //
    // Exception table:
    //   from	to	target	type
    //   23	37	74	java/lang/Throwable
    //   57	71	74	java/lang/Throwable
    //   2	7	102	finally
    //   23	37	102	finally
    //   37	43	102	finally
    //   57	71	102	finally
    //   76	82	102	finally
    //   87	94	102	finally
    //   94	99	102	finally
    //   87	94	107	java/lang/Throwable
  }

  public void release()
  {
    try
    {
      FileOutputStream localFileOutputStream = this.fos;
      if (localFileOutputStream == null);
      while (true)
      {
        return;
        unlock();
        try
        {
          this.fos.close();
          this.fos = null;
        }
        catch (Throwable localThrowable)
        {
        }
      }
    }
    finally
    {
    }
  }

  // ERROR //
  public void setLockFile(java.lang.String paramString)
  {
    // Byte code:
    //   0: aload_0
    //   1: monitorenter
    //   2: aload_0
    //   3: new 27	java/io/FileOutputStream
    //   6: dup
    //   7: aload_1
    //   8: invokespecial 56	java/io/FileOutputStream:<init>	(Ljava/lang/String;)V
    //   11: putfield 25	com/mob/tools/utils/FileLocker:fos	Ljava/io/FileOutputStream;
    //   14: aload_0
    //   15: monitorexit
    //   16: return
    //   17: astore_3
    //   18: aload_0
    //   19: getfield 25	com/mob/tools/utils/FileLocker:fos	Ljava/io/FileOutputStream;
    //   22: astore 4
    //   24: aload 4
    //   26: ifnull -12 -> 14
    //   29: aload_0
    //   30: getfield 25	com/mob/tools/utils/FileLocker:fos	Ljava/io/FileOutputStream;
    //   33: invokevirtual 52	java/io/FileOutputStream:close	()V
    //   36: aload_0
    //   37: aconst_null
    //   38: putfield 25	com/mob/tools/utils/FileLocker:fos	Ljava/io/FileOutputStream;
    //   41: goto -27 -> 14
    //   44: astore_2
    //   45: aload_0
    //   46: monitorexit
    //   47: aload_2
    //   48: athrow
    //   49: astore 5
    //   51: goto -15 -> 36
    //
    // Exception table:
    //   from	to	target	type
    //   2	14	17	java/lang/Throwable
    //   2	14	44	finally
    //   18	24	44	finally
    //   29	36	44	finally
    //   36	41	44	finally
    //   29	36	49	java/lang/Throwable
  }

  public void unlock()
  {
    try
    {
      FileLock localFileLock = this.lock;
      if (localFileLock == null);
      while (true)
      {
        return;
        try
        {
          this.lock.release();
          this.lock = null;
        }
        catch (Throwable localThrowable)
        {
        }
      }
    }
    finally
    {
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.mob.tools.utils.FileLocker
 * JD-Core Version:    0.6.2
 */